local lsp_kanpo = fk.CreateSkill {
    name = "lsp_kanpo",
    tags = { Skill.Compulsory, Skill.Switch },
}

Fk:loadTranslationTable {
    ["lsp_kanpo"] = "勘破",
    [":lsp_kanpo"] = "锁定技，转换技，与你距离1以内的其他角色使用基本牌时，你摸一张牌，然后，阳：你摸两张牌，随机弃置一张牌；阴：你摸一张牌，随机弃置两张牌。",

}
local spec = {
    anim_type = "switch",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(lsp_kanpo.name) and target ~= player and player:distanceTo(target) <= 1 and
            data.card.type == Card.TypeBasic
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        player:drawCards(1, lsp_kanpo.name)
        if player.shield == 0 and player:getMark("lsp_shuiyue-round") == 0 and player:hasSkill("lsp_shuiyue") then
            room:notifySkillInvoked(player, "lsp_shuiyue", "special")
            room:changeShield(player, 1) 
            room:addPlayerMark(player, "lsp_shuiyue-round")
        end
        if player:getSwitchSkillState(lsp_kanpo.name, true) == fk.SwitchYang then
            player:drawCards(2, lsp_kanpo.name)
            room:askToDiscard(player, {
                max_num = 1, min_num = 1, include_equip = true, skill_name = lsp_kanpo.name, cancelable = false,
            })
        else
            player:drawCards(1, lsp_kanpo.name)
            room:askToDiscard(player, {
                max_num = 2, min_num = 2, include_equip = true, skill_name = lsp_kanpo.name, cancelable = false,
            })
        end
    end,
}   
lsp_kanpo:addEffect(fk.CardUsing, spec)
-- lsp_kanpo:addEffect(fk.CardResponding, spec)

lsp_kanpo:addEffect(fk.AfterDying, {
    mute = true,
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(lsp_kanpo.name) and player:getMark("lsp_shuiyue-round") > 0
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:setPlayerMark(player, "lsp_shuiyue-round", 0)
    end,
})

return lsp_kanpo
